home *** CD-ROM | disk | FTP | other *** search
- from PSPApp import *
- import PSPUtils
- import os.path
-
- def ScriptProperties():
- return {
- 'Author': u'Corel Corporation',
- 'Copyright': u'Copyright (c) 2002-2006 Corel Corporation. All rights reserved.',
- 'Description': "Create a palette from the open image. The user is prompted for the number of colors to use.",
- 'Host': u'Paint Shop Pro',
- 'Host Version': u'8.00'
- }
-
- def Do(Environment):
- if PSPUtils.RequireADoc( Environment ) == App.Constants.Boolean.false:
- return
-
- # bring up the decrease colors to X dialog and let the user choose how many colors they want
- App.Do( Environment, 'DecreaseColorsToX', {
- 'Boost': App.Constants.Boolean.false,
- 'BoostAmount': 1,
- 'Colors': 256,
- 'IncludeWindowsColors': App.Constants.Boolean.false,
- 'ReductionMethod': 0,
- 'PaletteMethod': 0,
- 'ReduceBleeding': App.Constants.Boolean.false,
- 'GeneralSettings': {
- 'ExecutionMode': App.Constants.ExecutionMode.Interactive,
- 'AutoActionMode': App.Constants.AutoActionMode.Match
- }
- })
-
- # save the palette - set the palette name to match the name of the current document
- # don't specify a directory so that it goes to the last used dir
-
- # change the extension to .psppalette - truncate the file name at the last
- # period and slap on a .PspPalette extension
- PaletteFileName, OldExt = os.path.splitext( App.TargetDocument.Title )
- App.Do( Environment, 'SavePalette', {
- 'SavePaletteFileName': PaletteFileName,
- 'GeneralSettings': {
- 'ExecutionMode': App.Constants.ExecutionMode.Interactive,
- 'AutoActionMode': App.Constants.AutoActionMode.Match
- }
- })
-